<template>
  <div class="newList">
    <van-card
      v-for="item in newsList"
      :key="item.id"
      :title="item.title"
      :thumb="item.img_url"
      @click="getInfo(item.id)"
    >
      <div slot="price">
        2020年8月4日 11:23:56
      </div>
      <div slot="num">
        点击一次
      </div>
    </van-card>
  </div>
</template>
<script>
export default {
  data: () => ({
    newsList: []
  }),
  created () {
    this.getNewsList()
  },
  methods: {
    async getNewsList() {
      try {
        const { data: { message } } = await this.Api.getNewsList()
        // console.log(message)
        this.newsList = message
      } catch (error) {
        console.log('请求失败')
      }
    },
    getInfo(id) {
      this.$router.push('/home/newsinfo/' + id)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
